package cn.flying.cloud.system.model;

import java.io.Serializable;
import java.util.Objects;
import java.util.Set;

/**
 * 角色领域模型
 *
 * @author: admin
 * @date: 2023年06月12日 19:07
 * @version: 1.0
 */
public class Role implements Serializable {
    /**
     * 主键ID
     */
    private Long id;

    /**
     * 角色编码
     */
    private String roleId;

    /**
     * 角色名称
     */
    private String roleName;

    /**
     * 角色的类型，1：管理员角色，2：其他
     */
    private String type;

    /**
     * 状态
     */
    private String status;

    /**
     * 角色描述
     */
    private String remark;

    /**
     * 租户ID
     */
    private String tenantId;

    /**
     * 所属用户
     */
    private Set<User> users;

    private static final long serialVersionUID = 1L;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getRoleId() {
        return roleId;
    }

    public void setRoleId(String roleId) {
        this.roleId = roleId == null ? null : roleId.trim();
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName == null ? null : roleName.trim();
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type == null ? null : type.trim();
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status == null ? null : status.trim();
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark == null ? null : remark.trim();
    }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId == null ? null : tenantId.trim();
    }

    public Set<User> getUsers() {
        return users;
    }

    public void setUsers(Set<User> users) {
        this.users = users;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Role role = (Role) o;
        return Objects.equals(id, role.id) && Objects.equals(roleId, role.roleId) && Objects.equals(roleName, role.roleName) && Objects.equals(type, role.type) && Objects.equals(status, role.status) && Objects.equals(remark, role.remark) && Objects.equals(tenantId, role.tenantId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, roleId, roleName, type, status, remark, tenantId);
    }
}